# -*- coding: utf-8 -*-
"""
    @author:sirius
    @time:2017.10.14
"""
import pandas as pd
import numpy as np
import math
import time

def read_mdc():

    """
        根据'db_key'字段结合sys文件'battery'并存储到目标文件
        'latitude':电量消耗
        'charging':网络消耗
    """
    app_rec_data = pd.read_csv('./period/md_cache/app_rec_data.csv')

    sys_data = pd.read_csv('./datasets/sys.csv', sep='\t')
    sys_data = sys_data.loc[:, ['db_key','battery','charging']]

    # 组合application文件数据、records文件数据和gps文件数据
    data = pd.merge(app_rec_data, sys_data, how='left', on='db_key')
    data.to_csv('./cache/app_rec_sys.csv', index=False)

    print 'App_Rec_Sys-Finished...'

if __name__ == '__main__':
    read_mdc()
